package org.penguin.study.bk.controller;

import org.springframework.boot.web.context.WebServerApplicationContext;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author chengyinghua
 */
@RequestMapping("/container")
@RestController
public class ContainerController {

    @Resource
    private WebServerApplicationContext context;

    @GetMapping("/serverPort")
    public String getServerPort() {
        return String.format("Http端口: %d", context.getWebServer().getPort());
    }
}
